<template>
  <h1 class="m-v-30">模版引用</h1>
  <h3 class="m-v-10">访问模版引用ref</h3>
  <div>
    <div ref="dom1">dom1,获取这个dom,在组建挂载后才能应用<button @click="changeColor">
        改变这个dom的颜色
      </button></div>
  </div>

  <h3 class="m-v-10">v-for中模版的引用</h3>
  <div>

  </div>
</template>

<script setup>
import { ref } from "@vue/reactivity";
import { onMounted } from "@vue/runtime-core";
const dom1 = ref()


onMounted(() => {
  console.log(dom1.value);
})

function changeColor() {
  dom1.value.style.color = "#f00"
}


</script>

<style lang="scss" scoped>
</style>